// pages/dz/dz.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userName: '',
    userIphone:'',
    userdz1:'',
    userdz2:'',
   
  },
 xgdz:function(){
   wx.navigateTo({
     url: '/pages/gps/gps',
   })
 },
  setname: function (e) {
    // console.log(e.detail.value)设置用户名
    this.setData({
    userName: e.detail.value
    })
    },
    setiphone: function (e) {
      // console.log(e.detail.value)设置用户名
      this.setData({
      userIphone: e.detail.value
      })
      },
  tj:function(){
    var userName = this.data.userName;
    console.log(userName)
    var userIphone = this.data.userIphone;
    console.log(userIphone)
    var userDz1 = this.data.userdz1;
    var userDz2 = this.data.userdz2;
    // wx.navigateTo({
    //   url: '/pages/xzdz/xzdz?lxr='+,
    // })
    var that = this//不要漏了这句，很重要
   
     console.log(userDz2)
     console.log(userDz1)
    wx.request({

      
      url: 'http://192.168.137.1:8080/WEBPRO_18/dz_data_add' ,
      //localhost:8080
      data: {
      message: 'ty is the The most handsome man in the ESTA',
      userName_1: userName,
      userIphone: userIphone,
       userdzq: userDz1,
       userdzw: userDz2,
      },
      method: 'GET',
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {
        console.log("success")
        // that.setData({
        //   list_data_1: res.data,
          
        // });
        // console.log(res.data);//回调函数中的携带服务器响应数据
      },
      fail: function (res) {
        console.log("fail to connect");
      }
    })
    wx.navigateTo({
      url: '/pages/zdz/zdz',
    })  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    // console.log(options.ID)
    let dz1 = options.ID
    let dz2 = options.ID2
    this.data.userdz1 =  options.ID
    this.data.userdz2 = options.ID2
    // console.log(this.data.userdz2)
    // console.log(this.data.userdz1)
    
    that.setData({
      dz1: dz1,
      dz2: dz2,
      
    });
    // console.log(options.ID2)
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})